url = 'https://www.acwing.com/problem/content/description/3547/'

n = int(input())

for i in range(n):
    print(input().replace('111110', '11111'))
